<template>
  <view class="contentI">
    <view class="cont" v-if="tableData.length != 0">
      <view
        class="item"
        v-for="(item, index) in tableData"
        :key="index"
        @click="GoodDetail(item)"
      >
        <view class="leftimg">
          <image class="image" :src="Domain_IMG + item.Picture_URL" mode="scaleToFill" />
        </view>
        <view class="right">
          <view class="title">{{ item.Article_Name }}</view>
          <view class="jg">{{ item.Sales_Unit_Price + "/" + item.Unit }}</view>
          <view class="fl">{{ item.Category_Name }}</view>
          <view class="cont2">
            <view class="left">
              <!-- <view>发布人:{{ item.Contacts }} </view> -->
              <view class="view">所属企业 :{{ item.Enterprise_Name }} </view>
            </view>
          </view>
          <view class="but"> 查看详情 </view>
        </view>
      </view>
    </view>
    <view class="contI" v-else="tableData.length == 0"> 暂无数据 </view>
  </view>
</template>

<script>
const app = getApp();
import { GroupGoodsAll } from "@/api/group.js";
export default {
  name: "Tender",
  data() {
    return {
      form: {
        Article_Name: "",
        Category_SerialNumber: "",
        Enterprise_Info_SerialNumber: "",
        Group_Purchasing_SerialNumber: uni.getStorageSync(
          "Group_Purchasing_SerialNumber"
        ),
        Type: "0",
        // token: '',
        page: 1, //页数
        limit: 4, //每页数据条数
      },
      tableData: [],
      total: 0,
      Domain_IMG: app.globalData.Domain_IMG,
    };
  },
  props: {
    limit: {
      type: Number,
      default: 4,
    },
    page: {
      type: Number,
      default: 1,
    },
    Article_Name: {
      type: String,
      default: "",
    },
    Category_SerialNumber: {
      type: String,
      default: "",
    },
  },
  mounted() {
    this.form.limit = this.limit;
    this.form.page = this.page;
    this.getAuctiontransactions(this.form);
  },
  watch: {},
  methods: {
    //跳转
    GoodDetail(item) {
      uni.setStorageSync("Article_SerialNumber", item.Article_SerialNumber);
      uni.setStorageSync(
        "Sales_Unit_Price_SerialNumber",
        item.Sales_Unit_Price_SerialNumber
      );
      uni.setStorageSync("Store_SerialNumber", item.Store_SerialNumber);
      uni.navigateTo({
        url: "/components/Goods/goodsdetail",
      });
    },
    //请求数据
    async getAuctiontransactions(data) {
      uni.showLoading({
        title: "加载中...",
      });
      const res6 = await GroupGoodsAll({
        data: {
          Article_Name: "",
          page: 1,
          limit: 8,
          Category_SerialNumber: "",
          sort: 0,
        },
      });
      this.tableData = res6.tableData;
      uni.hideLoading();
    },
  },
};
</script>

<style lang="scss">
.contentI {
  width: 100%;
  // height: calc(100vh - 94px);
  background-color: #f5f5f5;
  padding: 0 0 20rpx 0;
  box-sizing: border-box;
  .cont {
    height: calc(100vh -44px);
    padding: 20rpx;
    box-sizing: border-box;
    background-color: #f5f5f5;

    .item {
      border-radius: 20rpx;
      background-color: #fff;
      padding: 25rpx;
      box-sizing: border-box;
      margin: 0 0 30rpx 0;
      display: flex;
      // width: 60%;
      .leftimg {
        display: flex;
        align-items: center;
        justify-content: center;

        .image {
          width: 258rpx;
          height: 258rpx;
          border-radius: 20rpx;
          margin: 0 10rpx 0 0;
        }
      }
      .right {
        width: 60%;
        padding: 10rpx;
        box-sizing: border-box;
        flex: 1;
        .fl {
          font-size: 28rpx;
        }
      }
      .title {
        font-size: 34rpx;
        color: #222;
        line-height: 34rpx;
        font-weight: 500;
      }
      .jg {
        font-size: 34rpx;
        color: #ff442f;
        vertical-align: middle;
        margin-right: 20rpx;
        // flex: 0 0 auto;
        margin: 20rpx 0 20rpx;
      }
      .cont2 {
        display: flex;
        justify-content: space-between;
        align-items: center;
        .left {
          font-size: 26rpx;
          color: rgba(34, 34, 34, 0.5);
          line-height: 26rpx;
          overflow: hidden;
          text-overflow: ellipsis;
          white-space: nowrap;
          .view {
            margin-top: 10px;
            overflow: hidden;
            text-overflow: ellipsis;
            white-space: nowrap;
          }
        }
      }
      .but {
        margin: 20rpx 0 0 0;
        width: 132rpx;
        height: 54rpx;
        border: 1px solid #39bf3e;
        border-radius: 28rpx;
        font-size: 26rpx;
        color: #39bf3e;
        text-align: center;
        letter-spacing: 0;
        font-weight: 500;
        display: flex;
        align-items: center;
        justify-content: center;
      }
    }
  }
  .contI {
    height: calc(100vh - 50px);
    color: #222;
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: center;
  }
}
</style>